<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>inweo.widgets.buttonMenu test</title>
		<script src="../lib/mootools.js"></script>
		<script src="../inweo.js"></script>
		<script type="text/javascript">
			function main() {
				inweo.require("box");
				inweo.require("button");
				inweo.require("menu");

				var page = new inweo.widgets.vbox(this);
				page.space(10);
				page.widget.setStyle("width", "250px");

				var pushButton = new inweo.widgets.pushButton();
				pushButton.text("I am a pushButton with menu");
				page.pack(pushButton);
				pushButton.shadow(true);

				var menu = new inweo.widgets.popupMenu();
				new inweo.core.event(pushButton).addEvent("mousedown", function() {
					menu.x = pushButton.widget.offsetTop + pushButton.widget.offsetHeight;
					menu.y = pushButton.widget.offsetLeft - 1;
					if (menu.visible == false) {
						menu.show();
					}
				});
				
				var menuItem =  new inweo.widgets.menuItem(menu);
				menuItem.text("I am a normal menuItem");
				menuItem.accelerator("d");
				menuItem.onClick(function() {
					alert("activated");
				});

				var menuItem2 =  new inweo.widgets.menuItem(menu);
				menuItem2.text("I am a normal menuItem 2");
				menuItem2.picture(inweo.get("path") + "/tests/InweoLogo.jpg");

				new inweo.widgets.menuItemSeparator(menu);

				var menuItemDisabled =  new inweo.widgets.menuItem(menu);
				menuItemDisabled.text("disabled menuItem");
				menuItemDisabled.disable(true);
				menuItemDisabled.picture(inweo.get("path") + "/tests/InweoLogo.jpg");

				var menuItemGroup =  new inweo.widgets.menuItemGroup(menu);
				menuItemGroup.text("I am a menuItemGroup");

					var menuItemGroup1 =  new inweo.widgets.menuItem(menuItemGroup);
					menuItemGroup1.text("I am a sub menuItem 1");
	
					var menuItemGroup2 =  new inweo.widgets.menuItem(menuItemGroup);
					menuItemGroup2.text("I am a sub menuItem 2");

					var menuItemGroup2 =  new inweo.widgets.menuItemGroup(menuItemGroup);
					menuItemGroup2.text("I am a menuItemGroup 2");

						var menuItemGroup2 =  new inweo.widgets.menuItem(menuItemGroup2);
						menuItemGroup2.text("I am a sub sub menuItem 2");
						menuItemGroup2.onClick(function() {
							alert("menu item clicked");
						});

				var menuItemCheckbox =  new inweo.widgets.menuItemCheckbox(menu);
				menuItemCheckbox.text("I am a Checkbox menuItem");

				var menuItemRadio1 =  new inweo.widgets.menuItemRadio(menu, "group1");
				menuItemRadio1.text("I am a radio menuItem 1");

				var menuItemRadio2 =  new inweo.widgets.menuItemRadio(menu, "group1");
				menuItemRadio2.text("I am a radio menuItem 2");
			}
		</script>
	</head>
	<body>
	</body>
</html>